import request from '@/utils/request';

// 普通用户接口
const baseUrl = '/delivery/order';


// 更新发货订单
export function updateDeliveryOrder(data) {
    return request({
        url: `${adminBaseUrl}/update`, method: 'put', data
    });
}

// 获取发货订单详情
export function getDeliveryOrderDetail(id) {
    return request({
        url: `${adminBaseUrl}/detail/${id}`, method: 'get'
    });
}

// 删除发货订单
export function deleteDeliveryOrder(id) {
    return request({
        url: `${adminBaseUrl}/delete/${id}`, method: 'delete'
    });
}

// 分页查询发货订单
export function pageDeliveryOrders(data) {
    return request({
        url: `${adminBaseUrl}/page`, method: 'post', data
    });
}

// 管理员接口
const adminBaseUrl = '/api/admin/delivery/order';


// 创建发货订单
export function createDeliveryOrder(data) {
    return request({
        url: `${adminBaseUrl}/create`, method: 'post', data
    });
}


// 管理员审核订单状态
export function auditOrderStatus(id, status) {
    return request({
        url: `${adminBaseUrl}/audit/${id}/${status}`, method: 'put'
    });
}

// 管理员分页查询
export function adminPageDeliveryOrders(data) {
    return request({
        url: `${adminBaseUrl}/page`, method: 'post', data
    });
}

// 管理员获取订单详情
export function adminGetDeliveryOrderDetail(id) {
    return request({
        url: `${adminBaseUrl}/detail/${id}`, method: 'get'
    });
}

// 管理员更新订单
export function adminUpdateDeliveryOrder(data) {
    return request({
        url: `${adminBaseUrl}/update`, method: 'put', data
    });
}

// 管理员删除订单
export function adminDeleteDeliveryOrder(id) {
    return request({
        url: `${adminBaseUrl}/delete/${id}`, method: 'delete'
    });
}
